package com.ibiaoke.boss.controller;

import com.ibiaoke.common.response.Res;
import com.ibiaoke.marketing.entity.ShareCouponRel;
import com.ibiaoke.marketing.service.ShareCouponRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class BossShareCouponRelController {

    @Autowired
    private ShareCouponRelService shareCouponRelService;


    @RequestMapping("/saveShareCouponRel")
    @ResponseBody
    public Res saveShareCouponRel(ShareCouponRel shareCouponRel) {
        shareCouponRelService.saveShareCouponRel(shareCouponRel);
        return Res.create();
    }


    @RequestMapping("/updateShareCouponRel")
    @ResponseBody
    public Res updateShareCouponRel(ShareCouponRel shareCouponRel) {
        shareCouponRelService.updateShareCouponRel(shareCouponRel);
        return Res.create();
    }


    @RequestMapping("/listShareCouponRel")
    @ResponseBody
    public Res listShareCouponRel(Integer marketingId, Integer couponId) {
        List<ShareCouponRel> list = shareCouponRelService.listShareCouponRel(marketingId, couponId);
        return Res.create().addResponse("shareCouponRelList", list);
    }


    @RequestMapping("/getShareCouponRel")
    @ResponseBody
    public Res getShareCouponRel(Integer id) {
        ShareCouponRel shareCouponRel = shareCouponRelService.getShareCouponRel(id);
        return Res.create().addResponse("shareCouponRel", shareCouponRel);
    }

}
